Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds user -> account linking #19

Merged
merged 6 commits into from
Apr 19, 2017
Merged

Conversation

michaloo
Copy link
Contributor

  • fix the requestExtract handler - allow passing path param
  • fix the .asUser() and .asAccount() to return traits and track
  • adds .asUser().account() method

@michaloo
Copy link
Contributor Author

Accounts JS API

const hull = new Hull({ id: "562123b470df84b740000042", secret: "1234", organization: "test" });

const scoped = hull.asAccount({ id: "123456" });
const scoped = hull.asAccount({ name: "Hull" });

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Account lookup by name is not available at the moment.
We can only lookup using domain or external_id

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okey, I've removed it from accountClaim properties and adjusted tests.

.to.have.property("sub")
.that.eql("123456");
.to.have.property("io.hull.asAccount")
.that.eql({ name: "Hull" });
});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could had a test for account traits without using asUser to set the account name (or anything else), like this : hull.asAccount({ domain: 'hull.io' }).traits({ name: 'Hull' })

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have one test for hull.asAccount() without user resolution. I would test traits on other place, but thanks, for pointing it out.


expect(scopedJwtClaims)
.to.have.property("io.hull.subjectType")
.that.eql("account");
expect(scopedJwtClaims)
.to.have.property("io.hull.asAccount")
.that.eql({ name: "Hull" });

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, name is not available here

});

it("should allow to link user to an existing account", () => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not actually linking. It is just a getter to the user's account

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, fixed.

@michaloo michaloo merged commit 1bf25df into release/0.11 Apr 19, 2017
@michaloo michaloo deleted the release/0.11.0-beta.3 branch May 5, 2017 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants